<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
	//前台首页
    public function index()
    {

	    //热品


	    //新品
	    $new_one = M('goods')->where(array('is_new=1'))->order('add_time desc')->limit('0,4')->select();
	    $this->assign('new_one',$new_one);

	    $new_two = M('goods')->where(array('is_new=1'))->order('add_time desc')->limit('4,8')->select();
	    $this->assign('new_two',$new_two);

	    //男装 取8条
	    $sql = 'select t1.* , t2.parent_id from goods as t1 inner join cat as t2  on t1.cat_id=t2.cat_id where t2.parent_id=1 order by add_time desc';
	    $man = M()->query($sql);
	    $this->assign('man',$man);

	    //男装 取8条
	    $sql = 'select t1.* , t2.parent_id from goods as t1 inner join cat as t2  on t1.cat_id=t2.cat_id where t2.parent_id=6 order by add_time desc';
	    $woman = M()->query($sql);
	    $this->assign('woman',$woman);


        $this->display();
    }

    











}